MWPW-183572: MAS Studio — AI assistant, product catalog, release flow, OST monorepo integration#776
Draft
Axelcureno wants to merge 3 commits intomainfrom
Draft
MWPW-183572: MAS Studio — AI assistant, product catalog, release flow, OST monorepo integration#776Axelcureno wants to merge 3 commits intomainfrom
Axelcureno wants to merge 3 commits intomainfrom
Conversation
…ntime Delivers the MAS Studio AI assistant experience and its supporting infrastructure. Everything ships in one commit so reviewers see a coherent feature set. Studio frontend (studio/src/): - AI chat UI: mas-chat.js + mas-chat-message.js + mas-chat-input.js + mas-chat-product-cards.js + mas-chat-session-selector.js + mas-chat-confirmation-summary.js + mas-chat-button-group.js + mas-chat-drawer.js + mas-chat-fab.js. Persistent sessions via chat-session-manager, markdown rendering with an LRU-bounded cache, operation-preview and destructive-tool confirmation gating. - Product catalog (mas-product-catalog.js + mas-product-detail.js) with multi-select filters, surface-scoped editor/settings access via groups.js (isMasAdmin + canAccessSettings + getUserSurfaces), DRAFT landscape toggle, applied-filter chips. - MCS-integrated release flow: deterministic fragment content from MCS merchandising data, dual-OSI plumbing for plans variants, multi-select OST hooked through rte/ost.js. - Shared services: mcp-client.js (defensive guards on response shape, AbortController on chat fetch, error-log scrubbing via logError). - utils/ai-card-mapper.js: XSS-escaped badge rendering, falsy-value preservation on fragment fields, trim-aware title fallbacks. - utils/mas-chat-helpers.js: pure helpers extracted for unit testing. IO Runtime - AI chat backend (io/studio/src/ai-chat/): - bedrock-client.js with prompt-injection defense via wrapUntrusted sentinel envelopes; attached-card fragment IDs wrapped element-wise instead of raw JSON.stringify. - operations-handler, operations-prompt, prompt-templates, response-parser, variant-configs, variant-knowledge-builder, knowledge-client, validation, index.js. IO Runtime - MCP server actions (io/mcp-server/): - 31 runtime actions (card + collection + offer + product CRUD/search). - Surface-scoped authz on fragment-creating actions (create-release-cards, create-card, create-collection, copy-card): deriveSurfaceFromPath + fetchUserGroups + canEditSurface + requireSurfaceAccess helpers in lib/ims-validator.js. Prevents cross-surface mutation via direct API calls. mas-mcp-server (stdio entry for Claude Code / Cursor): - Retired the Express HTTP bridge (http-server.js). Dropped cors/express deps + the 'http' npm script. Web-components: - Small audit touches on aem-fragment, merch-card-collection, variants/full-pricing-express, variants/simplified-pricing-express. Testing: - 10 new characterization-test files in studio/test/** covering every new service/util plus 2 XSS + 1 prompt-injection repro. - 2 new test files in io/studio/test/ai-chat/. - 1 new test file in io/mcp-server/test/lib/ covering surface authz (23 tests: canEditSurface matrix, fetchUserGroups, full middleware integration). Out of scope (deferred to follow-ups): - Per-fragment surface authz on id-based MCP mutations (update/delete/publish/bulk-*) - currently rely on AEM's own ACLs. - Translation work that entered this branch via a main merge is included as-is from main (no ticket changes to the translation subsystem).
Moves the OST (Offer Selector Tool) source from the separate tacocat.js/mas-ost tree into this repo as the 4th npm workspace alongside studio/, web-components/, and io/studio/. Changes: - mas-ost/ tree with Lit 3 + Spectrum Web Components source, Vite build config, WTR tests, and dev HTML pages. 63 source + test files extracted from tacocat.js commit f5a71b9. - Root package.json registers mas-ost in the workspaces array. - mas-ost/package.json build script outputs the IIFE bundle and copies it to ../studio/ost/index.js in one step (replaces the previous cross-repo deploy:local workflow). - Root package-lock.json regenerated by npm install to wire the new workspace and dedupe Lit/SWC against the root. Bundle output (studio/ost/index.js) is already in the previous commit alongside the frontend consumer changes. This commit adds the source side so the OST is maintained in-repo going forward. Known: 4 mas-ost unit tests fail upstream (3 country-picker SWC lifecycle + 1 OstStore.addOffer.tryBuy). Inherited from the source, not regressions from the relocation. Tracked as follow-up.
- Deterministic router for bare offer IDs, arrangement codes, and OSIs so PA codes and arrangement slugs (e.g. cptv_direct_individual) no longer misclassify as OSIs. - Offer-id fallback in resolveOfferSelector for 32-hex IDs that OST surfaces in the OSI slot for draft offers. - Trial-CTA yes/no step inserted on the OST Use shortcut path so users can still add a free-trial offer when seeding from a single offer. - Rename "Annual, paid monthly" to "Annual, billed monthly" (ABM). - Product card auto-selects its single match via productCardsSelectedValue so the preview card renders as confirmed, not clickable. - OST: pin filled-slot colors to light-palette hex so labels stay readable against saturated-green backgrounds in dark themes. - OST: hide the "BOTH" landscape badge (kept per-offer source badges). - Replace sp-icon-offer with sp-icon-label for the Search offers chip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MAS Studio AI assistant, product catalog, release-flow enhancements, and the mas-ost monorepo workspace integration.
Resolves https://jira.corp.adobe.com/browse/MWPW-183572
QA Checklist: https://wiki.corp.adobe.com/display/adobedotcom/M@S+Engineering+QA+Use+Cases
What is in this PR
Two commits, both tagged with the Jira ticket:
MWPW-183572: AI chat assistant, product catalog, release flow + IO Runtime— the full feature delivery plus the pre-review audit fixes baked in.MWPW-183572: integrate mas-ost as a monorepo workspace— OST source relocated from tacocat.js/mas-ost into this repo as the 4th npm workspace. Distinct architectural change, separate commit so reviewers can isolate the build/workspace question.Feature commit contents
Studio frontend
mas-chat.js+ friends): Bedrock-backed, persistent sessions viachat-session-manager, operation preview + confirmation gating, destructive-tool allowlist enforced on the client.mas-product-catalog.js/mas-product-detail.js): multi-select filters, surface-scoped editor/settings access (groups.jsintroducesisMasAdmin,canAccessSettings,getUserSurfaces), DRAFT landscape toggle, applied-filter chips.rte/ost.js.services/mcp-client.js: defensive guards on MCP response shapes (publish/get/copy/update contract drifts),AbortControlleron the AI chat fetch, URL-scrubbedlogErrorhelper applied across 14 call sites.utils/ai-card-mapper.js: XSS-safe badge HTML via escape helpers; preserves explicit falsy field values (0,'',false); trim-aware title fallback chain.utils/mas-chat-helpers.js: pure helpers extracted for direct unit testing.markdown-parser.js: LRU-bounded cache to short-circuit repeat renders.IO Runtime — AI chat backend (
io/studio/src/ai-chat/)wrapUntrustedsentinel envelopes. Attached-card fragment IDs wrapped element-wise instead of rawJSON.stringifyto close a breakout vector.bedrock-client,operations-handler,operations-prompt,prompt-templates,response-parser,variant-configs,variant-knowledge-builder,knowledge-client,validation,index.js.IO Runtime — MCP server (
io/mcp-server/)create-release-cards,create-card,create-collection,copy-card) via new helpers inlib/ims-validator.js—deriveSurfaceFromPath,fetchUserGroups,canEditSurface,requireSurfaceAccess. Prevents cross-surface mutation via direct API calls.mas-mcp-server (stdio entry for Claude Code / Cursor)
http-server.js). Droppedcors/expressdeps + thehttpnpm script.Web components
aem-fragment,merch-card-collection, Express pricing variants.mas-ost workspace commit
tacocat.js/mas-ost@f5a71b9: Lit 3 + Spectrum Web Components, Vite build, WTR tests.package.jsonworkspaces. Build script outputs the IIFE bundle and copies to../studio/ost/index.jsin one step.window.ost.openOfferSelectorToolexposed, all 5 custom elements registered, no JS errors at load).Testing
main).studio/test/**covering every new service/util + 2 XSS + 1 prompt-injection repro.io/studio/test/ai-chat/(bedrock-client,operations-handler).io/mcp-server/test/lib/with 23 tests:canEditSurfacematrix,fetchUserGroupsedge cases, fullrequireSurfaceAccessmiddleware integration.OstStore.addOffer.tryBuy). Not regressions from the integration. Tracked as follow-up.Please do the steps below before submitting your PR for a code review or QA
Follow-up (filed as deferred, not PR-blocking)
update-card,delete-card,publish-card,bulk-*). This PR gates path-based creation; id-based mutations currently rely on AEM's own ACLs to scope access.14257-merchatscale-axelremains hardcoded instudio/src/constants.js,studio/src/services/product-api.js, andio/studio/src/ai-chat/knowledge-client.jswith a TODO pointing at the post-merge swap tomasstudioonce that deploy completes.io/knowledge(the AI knowledge service / RAG backend) was intentionally scoped out of this PR. It's a separate Runtime app with its own lifecycle;RAG_ENABLED=falsekeeps the chat fully functional without it.Test URLs:
Screenshots
To be added: OST dialog opened from AI chat, product catalog with multi-select filters, AI chat confirmation summary, release card preview.